package com.fausto.learnimprint.log

import org.springframework.data.mongodb.core.mapping.MongoId
import java.io.Serializable
import java.util.*

open class BaseLog(
    @MongoId
    var id: String?,
    var time: Int?,     //执行时间
    var date: Date?
) : Serializable {
    constructor() : this(null, null, null)

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is BaseLog) return false

        if (id != other.id) return false
        if (time != other.time) return false
        if (date != other.date) return false

        return true
    }

    override fun hashCode(): Int {
        var result = id?.hashCode() ?: 0
        result = 31 * result + (time ?: 0)
        result = 31 * result + (date?.hashCode() ?: 0)
        return result
    }

    override fun toString(): String {
        return "BaseLog(id=$id, time=$time, date=$date)"
    }


}